/*
+--------------------------
| FreeloaderOS v0.0.1
|  - Microkernel
+--------------------------
| Written by Alec Hussey
| Copyright (c) 2007
|  - Deus X Foundation
+---------------------------
*/

/*
 * Main / Kernel Init
 */

#ifndef _LIBC_STDARG_H
#define _LIBC_STDARG_H

#define va_start(AP, LASTARG) \
			(AP = ((va_list) & (LASTARG) + va_size(LASTARG)))

#define va_arg(AP, TYPE) \
			(AP += _va_rounded_size(TYPE), \
			*((TYPE*)(AP - _va_rounded_size(TYPE))))

#define _va_rounded_size(TYPE) \
			(((sizeof(TYPE) + sizeof(int) - 1) / sizeof(int)) * sizeof (int))

#define va_size(TYPE) \
			((sizeof(TYPE) + sizeof(STACKITEM) - 1) & ~(sizeof(STACKITEM) - 1))

#define STACKITEM int

#define va_end(AP)

typedef unsigned char *va_list;

#endif
